//
//  LBDownloaderWork.h
//  LBDownloader
//
//  Created by WuShiHai on 19/6/14.
//  Copyright (c) 2019 Lebbay All rights reserved.
//

#import <Foundation/Foundation.h>
#import "LBDownloaderModel.h"

typedef void (^LBDownloaderWorkCompleteBlock)(NSURLResponse * response, NSURL * filePath, NSError *error);


typedef NS_ENUM(NSUInteger, LBDownloaderFileState) {
    LBDownloaderFileStateUnkown = 0, //状态未知，表示还未从本地查询状态
    LBDownloaderFileStateNone = 1,   //本地没有
    LBDownloaderFileStateDownloading = 2, //下载中
    LBDownloaderFileStateDownloadFailed = 3, //下载失败
    LBDownloaderFileStateDownloaded = 4, //已经下载了压缩包
    LBDownloaderFileStateUnziping = 5,   //正在解压
    LBDownloaderFileStateUnzipFailed = 6, //解压失败
    LBDownloaderFileStateUnziped = 7     //已经解压成了文件夹
};

@interface LBDownloaderWork : NSObject

/**
 下载原型
 */
@property (nonatomic, strong) LBDownloaderModel *downloader;

/**
 文件下载状态
 */
@property (nonatomic, assign) LBDownloaderFileState state;

/**
 文件是否下载

 @return YES或NO
 */
- (BOOL)isDownloaded;

/**
 文件是否已经解压缩

 @return YES或NO
 */
- (BOOL)isUnziped;

/**
 文件唯一标识

 @return 标识
 */
- (NSString *)identity;

/**
 拷贝本地文件到下载目录中，然后下载

 @param filePath 文件路径
 @param isUnzip 是否解压缩
 @return 是否操作成功
 */
- (BOOL)copyFile:(NSString *)filePath
         isUnzip:(BOOL)isUnzip;

@end
